// 封装专门发新闻相关的请求
import instance from "../utils/request";

export const getArticle = ({ channel_id, timestamp }) => {
  return instance({
    url: "/v1_1/articles",
    method: "get",
    params: {
      channel_id,
      timestamp,
      with_top: 0,
    },
  });
};

// 封装对不感兴趣请求
export const dislike = (art_id) => {
  return instance({
    url: "/v1_0/article/dislikes",
    method: "POST",
    data: { target: art_id },
  });
};

// 举报请求
export const report = (art_id, type) => {
  return instance({
    url: "/v1_0/article/reports",
    method: "post",
    data: {
      target: art_id,
      type,
    },
  });
};

// 获取联想建议
export const suggest = (q) => {
  return instance({
    url: "/v1_0/suggestion",
    method: "get",
    params: {
      q,
    }
  });
};

// 获取搜索文章
export const searchArticle = ({page,per_page,q})=>{
  return instance({
    url:'/v1_0/search',
    method:'GET',
    params:{
      page,
      per_page,
      q
    }
  })
}

// 封装一个发布文章详情的接口
export const articleDetail = (id)=>{
  return instance({
    url:'/v1_0/articles/'+id,
    method:'GET'
  })
}